package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.DeleteIndentBean;
import com.lwj.liwanjia.impl.DeleteIndentView;
import com.lwj.liwanjia.model.DeleteIndentModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/19.
 */

public class DeleteIndentPresenter {
    private DeleteIndentView deleteIndentView;
    private DeleteIndentModel deleteIndentModel;

    public DeleteIndentPresenter(DeleteIndentView deleteIndentView) {
        this.deleteIndentView = deleteIndentView;
        deleteIndentModel = new DeleteIndentModel();
    }

    public void deleteIndent(String token, String tradeId) {
        if (deleteIndentView != null) {
            deleteIndentModel.deleteIndent(token, tradeId, new Subscriber<DeleteIndentBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    deleteIndentView.showError((Exception) e);
                }

                @Override
                public void onNext(DeleteIndentBean deleteBean) {
                    deleteIndentView.deleteIndent(deleteBean);
                }
            });
        }
    }
}
